import moment from 'moment';
import React from 'react';
import { Table, Descriptions, Card } from 'antd';

class ViewPage extends React.Component<any, any> {
    render() {
        const { data, configData } = this.props
        const node = data.data;
        const details = data.details;
        const columns = [
            {
                title: '物料编码',
                dataIndex: 'partNum',
            },
            {
                title: '描述',
                dataIndex: 'partDescription',
            },
            {
                title: '客户编码',
                dataIndex: 'custPartNum',
            },
            {
                title: '出货数量',
                dataIndex: 'ourJobShipQty',
            },
            {
                title: '单位',
                dataIndex: 'ium',
            },
        ];
        return (
            <Card bordered={false} key="C1">
                <Descriptions key="1" title={<h2 style={{textAlign:'center'}}>出货单</h2>} bordered={false}>
                    <Descriptions.Item label="出货单号">{node?.packNum}</Descriptions.Item>
                    <Descriptions.Item label="订单号" span={2}>{details ? details[0]?.orderNum : ''}</Descriptions.Item>
                    <Descriptions.Item label="公司名称"><strong>{configData.companyName}</strong></Descriptions.Item>
                    <Descriptions.Item label="出货人">{node?.shipPerson}</Descriptions.Item>
                    <Descriptions.Item label="出货日期">{moment(node?.shipDate).format('YYYY-MM-DD')}</Descriptions.Item>
                    <Descriptions.Item label="客户名称"><strong>{node?.custName}</strong></Descriptions.Item>
                    <Descriptions.Item label="终端客户" span={2}><strong>{details ? details[0]?.finCustName : ''}</strong></Descriptions.Item>
                </Descriptions>
                <Table
                    key="2"
                    rowKey="id"
                    columns={columns}
                    dataSource={details}
                    pagination={false}
                    bordered
                    footer={() => <span>仓管签字：__________  出货人签字：__________</span>} />

            </Card>
        )
    }
}

export default ViewPage